﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>新建字段向导</title>
    <link rel="stylesheet" type="text/css" href="../../Scripts/easyUI/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/easyUI/themes/icon.css" />
    <script type="text/javascript" src="../../Scripts/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery/jquery.easyui.min.js"></script>
    <script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Scripts/PinYin.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <style>
        body {
            font-family: Microsoft YaHei;
        }

        input:first-line {
            /**font-weight:bolder;*/
        }
    </style>
    <script language="javascript" type="text/javascript">

        /* ESC Key Down */
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        var fk_mapdata = GetQueryString("FK_MapData");
        var groupID = GetQueryString("GroupField");
        if (groupID == null)
            groupID = 0;

        var fType = GetQueryString("FType");
        var isDtlAdd = GetQueryString("IsDtlAdd") || "0";
        //页面启动函数.
        $(function () {

            var fk_mapData = GetQueryString("FK_MapData");
            if (fk_mapData == null || fk_mapData == "") {
                alert("参数FK_MapData为空.");
                return;
            }
            //如果是常用字段模板，就隐藏这个功能入口
            if (fk_mapData == "Temp0") {
                $("#Temp0").hide();
            }
            var fType = GetQueryString("FType");
            if (fType == null || fType == "")
                fType = 1;

            //类型.
            $("#RB_F_" + fType).attr('checked', 'checked');

            var mytb = document.getElementById("TB_Name");
            mytb.focus();
            $('#TB_Name').blur(function () //文本失去焦点时触发的事件
            {
                var TB_Name = document.getElementById("TB_Name").value;
                var val = $('input:radio[name="RB_QPJP"]:checked').val();
                if (TB_Name == "") {
                    document.getElementById("TB_No").value = "";
                    return;
                }

                if (val == "ziduanquanpin") {
                    ParsePinYin(TB_Name, true, "TB_No");
                }
                else {
                    ParsePinYin(TB_Name, false, "TB_No");
                }

            });
            //点击全拼
            $('input[id=RB_QP]').change(function () {
                var TB_Name = document.getElementById("TB_Name").value;
                ParsePinYin(TB_Name, true, "TB_No");

            });
            //点击简拼
            $('input[id=RB_JP]').change(function () {
                var TB_Name = document.getElementById("TB_Name").value;
                ParsePinYin(TB_Name, false, "TB_No");
            });

        });


        function Create(isSaveAndNew) {

            var name = $("#TB_Name").val();
            if (name == '' || name == null) {
                alert('请输入字段中文名称');
                return;
            }

            var no = $("#TB_No").val();
            if (no == '' || no == null) {
                alert('请输入字段英文名称');
                return;
            }

            if (ContainsChinese(no)) {
                alert('字段英文名称 不能包含汉字！');
                return;
            }

            var fType = $('input[name="RB_FType"]:checked').val();

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.Clear();

            if (plant == "CCFlow")
                name = encodeURIComponent(name);

            //特殊判断系统字段.
            if (no.toUpperCase() == "BILLNO")
                no = "BillNo";

            //特殊判断系统字段.
            if (no.toUpperCase() == "NO")
                no = "MyNo";

            handler.AddPara("name", name);
            handler.AddPara("FType", fType);
            handler.AddPara("FK_MapData", fk_mapdata);
            handler.AddPara("KeyOfEn", no);
            handler.AddPara("GroupField", groupID);
            handler.AddPara("FK_Flow", GetQueryString("FK_Flow"));

            var data = handler.DoMethodReturnString("FieldTypeSelect_Create");
            if (data.indexOf("err@") >= 0) {
                alert(data);
                return;
            }

            var url = data.replace('url@', '');
            if (isSaveAndNew == false) {
                SetHref( url + "&inlayer=" + GetQueryString("inlayer"));
                return;
            }

            SetHref("FieldTypeList.htm?FType=" + fType + "&FK_MapData=" + fk_mapdata + "&GroupField=" + groupID + "&m=" + Math.random());
            return;
        }

        function ContainsChinese(str) {

            ///<summary>判断指定字符串是否包含汉字</summary>
            if (!str) {
                return false;
            }

            return new RegExp("[\\u4E00-\\u9FFF]+", "g").test(str);
        }

        //在这里把返回值获取到，放入到对应的文本框里.
        function SelectOne() {
            var url = "FieldTypeListChoseOneField.htm?FK_MapData=" + GetQueryString("FK_MapData");
            SetHref(url);
        }

        function ToTemplate() {
            var url = "./Template/Fields.htm?FK_MapData=" + GetQueryString("FK_MapData");
            SetHref(url);
        }

        function HidAttr() {
            var url = 'HidAttr.htm?FK_MapData=' + GetQueryString("FK_MapData");
            SetHref(url);
        }

    </script>
    <!--<base target="_self" /> -->
    <link href="../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
  
</head>
<body>
    <form id="cc">
        <table class="ccbmp-table">
            <tr>
                <th colspan="2">
                    <div style="float: left">
                        新增普通类型的字段
                    </div>
                    <div style="float: right" id="Temp0">
                        <a href="javascript:HidAttr();">隐藏字段</a> &nbsp; &nbsp;
                        <a href="javascript:ToTemplate();">常用字段模版</a>
                    </div>
                </th>
            </tr>
            <tr>
                <td valign="top" style="width: auto">
                    <!-- *******************************************************  开始普通类型的字段    -->
                    <table>
                        <tr>
                            <td nowarp="true">
                                中文名
                            </td>
                            <td>
                                <input style="font-weight:bolder;" type="text" name="TB_Name" id="TB_Name" />
                            </td>
                        </tr>
                        <tr>
                            <td nowarp="true">
                                英文名
                            </td>
                            <td>
                                <input type="text" name="TB_No" id="TB_No" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <input type="radio" name="RB_QPJP" id="RB_QP" checked="checked" value="ziduanquanpin" />
                                <label for="RB_QP">
                                    全拼
                                </label>
                                <input type="radio" name="RB_QPJP" id="RB_JP" value="ziduanjianpin" />
                                <label for="RB_JP">
                                    简拼
                                </label>
                                <a href="javaScript:void(0)" onclick="SelectOne();" title="从数据表里选择字段" class="easyui-linkbutton"
                                   data-options="toggle:true">更多...</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <a href="javaScript:void(0)" onclick="Create(false);" class="easyui-linkbutton" data-options="toggle:true">
                                    创建字段
                                </a> <a href="javaScript:void(0)" onclick="Create(true);" class="easyui-linkbutton"
                                        data-options="toggle:true">保存+创建</a>
                                <!--<input type="button" id="Btn_Create" value="创建新字段" name="Btn_Create"  onclick="Create();" />-->
                            </td>
                        </tr>
                    </table>
                    <!-- end *******************************************************  普通类型的字段    -->
                </td>
                <td style="width: 60%">
                    <input type="radio" name="RB_FType" id="RB_F_1" value="1" />
                    <label for="RB_F_1">
                        字符型。<font color="Gray">如:姓名、地址、邮编、电话。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_2" value="2" />
                    <label for="RB_F_2">
                        整数型。<font color="Gray">如:年龄、个数。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_8" value="8" />
                    <label for="RB_F_8">
                        金额型。<font color="Gray">如:单价、薪水。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_3" value="3" />
                    <label for="RB_F_3">
                        浮点型。<font color="Gray">如：身高、体重、长度。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_5" value="5" />
                    <label for="RB_F_5">
                        双精度。<font color="Gray">如：亿万、兆数值类型单位。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_6" value="6" />
                    <label for="RB_F_6">
                        日期型。<font color="Gray">如：出生日期、发生日期yyyy-MM-dd。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_7" value="7" />
                    <label for="RB_F_7">
                        日期时间型。<font color="Gray">如：发生日期时间yyyy-MM-dd HH:mm。</font><br />
                    </label>
                    <input type="radio" name="RB_FType" id="RB_F_4" value="4" />
                    <label for="RB_F_4">
                        Boole型(是/否)。<font color="Gray">如：是否完成、是否达标。</font><br />
                    </label>
                </td>
            </tr>
            <tr>
                <th colspan="2">
                    新增枚举字段(用来表示，状态、类型...的数据。)
                </th>
            </tr>
            <tr>
                <td colspan="2">
                    <script type="text/javascript">

                        var groupID = GetQueryString("GroupField");

                        function Enum(doType) {
                            var webUser = new WebUser();
                            if (webUser.CCBPMRunModel == 2) {
                                SetHref('../../../Admin/CCFormDesigner/SysEnum/List.htm?DoType=' + doType + '&FK_MapData=' + fk_mapdata + '&GroupField=' + groupID);
                            } else {
                                SetHref('SysEnumList.htm?DoType=' + doType + '&FK_MapData=' + fk_mapdata + '&GroupField=' + groupID);
                                }
                        }

                        function Table(doType) {
                            var webUser = new WebUser();
                            // SaaS模式下进入SaaS下页面
                            if (webUser.CCBPMRunModel == 2) {
                                SetHref('../../../Admin/CCFormDesigner/SFList.htm?DoType=' + doType + '&FK_MapData=' + fk_mapdata + '&FType=Class&GroupField=' + groupID);
                            } else {
                                SetHref('SFList.htm?DoType=' + doType + '&FK_MapData=' + fk_mapdata + '&FType=Class&GroupField=' + groupID);
                            }
                        }

                        function TableGuide() {
                            ///WF/Comm/Sys/SFGuide.aspx?DoType=New&FK_MapData=<%=this.FK_MapData %>&GroupField=<%=this.GroupField %>
                            var webUser = new WebUser();
                            // SaaS模式下进入SaaS下页面
                            if (webUser.CCBPMRunModel == 2) {
                                SetHref('../../../Admin/CCFormDesigner/SFTable/Default.htm?DoType=New&FK_MapData=' + fk_mapdata + '&FType=Class&GroupField=' + groupID);
                            } else {
                                SetHref('./SFTable/Default.htm?DoType=New&FK_MapData=' + fk_mapdata + '&FType=Class&GroupField=' + groupID);
                            }
                           
                        }
                        function ImpTableField() {
                            var winWidth = 1050;
                            var winHeight = 600;
                            var iTop = (window.screen.height - 30 - winHeight) / 2; //获得窗口的垂直位置;
                            var iLeft = (window.screen.width - 10 - winWidth) / 2; //获得窗口的水平位置;
                            window.open("ImpTableField.htm?FK_MapData=" + GetQueryString("FK_MapData"), "_blank", "height=" + winHeight + "px,width=" + winWidth + "px,top=" + iTop + ",left=" + iLeft + ",toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no");
                            //var url = 'ImpTableField.htm?FK_MapData='+GetQueryString('FK_MapData')+'&FType=Class&Idx=&GroupField=0';
                            //window.location.href = filterXSS(url);
                        }

                        //图片组件.
                        function ExtImg() {

                            var name = promptGener('请输入图片名称:\t\n比如:肖像、头像、ICON、地图位置', '肖像');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            // alert(frmID + imgName);
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtImg();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                return;
                            }
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.UIContralType = 11; //FrmImg 类型的控件
                            mapAttr.MyDataType = 1;
                            mapAttr.ColSpan = 0; //单元格.
                            mapAttr.LGType = 0;
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();

                            var en = new Entity("BP.Sys.FrmUI.ExtImg");
                            en.MyPK = frmID + "_" + id;
                            en.FK_MapData = frmID;
                            en.KeyOfEn = id;

                            en.ImgAppType = 0; //图片.
                            en.FK_MapData = frmID;
                            en.GroupID = mapAttr.GroupID; //设置分组列.
                            en.Name = name;
                            en.Insert(); //插入到数据库.
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtImg&MyPK=" + en.MyPK);
                        }

                        //图片附件.
                        function ExtImgAth() {

                            var name = promptGener('请输入图片名称:\t\n比如:肖像、头像、ICON', '肖像');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtImgAth();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                return;
                            }
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.UIContralType = 12; //FrmImgAth 类型的控件.
                            mapAttr.MyDataType = 1;
                            mapAttr.ColSpan = 0; //单元格.
                            mapAttr.LGType = 0;
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();

                            var en = new Entity("BP.Sys.FrmUI.FrmImgAth");
                            en.MyPK = frmID + "_" + id;
                            en.FK_MapData = frmID;
                            en.CtrlID = id;
                            en.Name = name;
                            en.GroupID = mapAttr.GroupID; //设置分组列.
                           
                            en.Insert(); //插入到数据库.
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.FrmImgAth&MyPK=" + en.MyPK);
                        }

                        //身份证
                        function ExtIDCard() {
                            var IDCard = [{ No: "IDCardName", Name: "姓名" }, { No: "IDCardNo", Name: '身份证号' }, {No:"IDCardAddress",Name:"地址"}];
                            var frmID = GetQueryString("FK_MapData");
                            for (var i = 0; i < IDCard.length; i++) {
                                var mapAttr = new Entity("BP.Sys.MapAttr");
                                mapAttr.SetPKVal(frmID + "_" + IDCard[i].No);
                                if (mapAttr.RetrieveFromDBSources() == 0) {
                                    mapAttr.FK_MapData = frmID;
                                    mapAttr.KeyOfEn = IDCard[i].No;
                                    mapAttr.Name = IDCard[i].Name;
                                    mapAttr.GroupID = groupID;
                                    mapAttr.UIContralType = 13; //身份证号.
                                    mapAttr.MyDataType = 1;
                                    if (IDCard[i].No =="IDCardAddress")
                                        mapAttr.ColSpan = 3; //单元格.
                                    else
                                        mapAttr.ColSpan = 1;
                                    mapAttr.LabelColSpan = 1;
                                    mapAttr.LGType = 0; //文本
                                    mapAttr.UIIsEnable = 0; //不可编辑
                                    mapAttr.UIIsInput = 1;//必填
                                    mapAttr.UIWidth = 150;
                                    mapAttr.UIHeight = 23;
                                    mapAttr.Insert(); //插入字段.
                                } else {
                                    alert("字段" + IDCard[i].No + "已存在，请变更表单中的" + mapAttr.Name + "的编号");
                                    
                                }
                               
                            }
                            alert("创建成功");
                        }

                        //系统定位（需要创建唯一)
                        function MapAttrFixed() {
                            var mapAttr = new Entity("BP.Sys.FrmUI.MapAttrFixed");
                            mapAttr.SetPKVal(GetQueryString("FK_MapData") + "_Fixed");
                            if (mapAttr.RetrieveFromDBSources() == 0) {
                                mapAttr.FK_MapData = GetQueryString("FK_MapData");
                                mapAttr.KeyOfEn = "Fixed";
                                mapAttr.Name = "系统定位";
                                mapAttr.GroupID = 1;
                                mapAttr.UIContralType = 16; //系统定位
                                mapAttr.MyDataType = 1;
                                mapAttr.ColSpan = 1;
                                mapAttr.LabelColSpan = 1;
                                mapAttr.LGType = 0; //文本
                                mapAttr.UIIsEnable = 0; //不可编辑
                                mapAttr.UIIsInput = 0;
                                mapAttr.UIWidth = 150;
                                mapAttr.UIHeight = 23;
                                mapAttr.Insert(); //插入字段.
                                alert("创建成功");
                            } else {
                                alert("表单" + GetQueryString("FK_MapData") + "已经存在系统定位按钮，不能重复创建");
                                return;
                            }
                            ens.Retrieve("FK_MapData", GetQueryString("FK_MapData"), "Text", "系统定位");
                            
                        }

                        //附件.
                        function ExtAth() {
                           debugger
                            var name = promptGener('请输入附件名称:\t\n比如:报送材料、报销资料', '附件');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                           
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtAth();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);

                            var mypk = frmID + "_" + id;
                            if (isDtlAdd == "1")
                                mypk = frmID + "_" + id +"_AthMDtl";
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                return;
                            }
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id+"_AthMDtl";
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID || 0;
                            mapAttr.UIContralType = 6; //附件控件.
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 3; //
                            mapAttr.LabelColSpan = 1; //
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.IsEnableInAPP = 0;
                            mapAttr.Insert(); //插入字段.

                            mapAttr.Retrieve();

                            var en = new Entity("BP.Sys.FrmAttachment");
                            en.MyPK = mypk;
                            en.FK_MapData = frmID;
                            en.NoOfObj = id + "_AthMDtl";
                            en.GroupID = mapAttr.GroupID; //设置分组列.
                            en.Name = name;
                            en.UploadType = 1; //多附件.
                            en.IsVisable = 0; //让其不可见.
                            en.CtrlWay = 4; // 按流程WorkID计算
                            en.SetPara("IsShowMobile", 1);
                            en.Insert(); //插入到数据库.
                            SetHref("../../Comm/En.htm?EnName=BP.Sys.FrmUI.FrmAttachmentExt&MyPK=" + en.MyPK);
                        }

                        //超链接.
                        function ExtLink() {

                            var name = promptGener('请输入超链接名称:\t\n比如:我的连接、点击这里打开', '我的连接');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            // alert(frmID + imgName);
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtLink();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);
                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtLink();
                                return;
                            }

                            var link = promptGener('请输入超链地址:\t\n比如:https://gitee.com/opencc', 'https://gitee.com/opencc');
                            if (link == null || link == undefined)
                                return;

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.SetPara("Url", link.replace(/@/g, '$'));
                            mapAttr.UIContralType = 9; //超链接.
                            mapAttr.MyPK = mypk;
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 0; //
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.Tag1 = "_blank"; //打开目标.
                            mapAttr.Tag2 = link; // 超链接地址.
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtLink&MyPK=" + mapAttr.MyPK);
                        }

                        //评分控件
                        function ExtScore() {

                            var name = promptGener('请输入评分事项名称:\t\n比如:快递速度，服务水平', '评分事项');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtScore();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);
                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtScore();
                                return;
                            }

                            var score = promptGener('请设定总分:\t\n比如:5，10', '5');
                            if (score == null || score == undefined)
                                return;

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.UIContralType = 101; //评分控件.
                            mapAttr.MyPK = mypk;
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 1; //
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.Tag2 = score; // 总分
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtScore&MyPK=" + mapAttr.MyPK);
                        }
                        //大块文本
                        function ExtBigNoteHtmlText() {

                            var frmID = GetQueryString("FK_MapData");
                            //增加大文本
                             if (window.confirm('您确认要创建吗？') == false)
                                return;
                            SetHref("./EditFExtContral/60.BigNoteHtmlText.htm?FrmID=" + frmID);
                        }

                        //手写签名版.
                        function ExtHandWriting() {

                            var name = promptGener('请输入签名版名称:\t\n比如:签字版、签名', '签字版');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            // alert(frmID + imgName);
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtHandWriting();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);
                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtHandWriting();
                                return;
                            }

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.UIContralType = 8; //手写签名版.
                            mapAttr.MyPK = mypk;
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 1; //
                            mapAttr.UIWidth = 150;
                            mapAttr.UIHeight = 170;
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtHandWriting&MyPK=" + mapAttr.MyPK);
                        }
                        //地图控件.
                        function ExtMap() {

                            var name = promptGener('请输入地图名称:\t\n比如:中国地图', '地图');
                            if (name == null || name == undefined)
                                return;

                            var frmID = GetQueryString("FK_MapData");
                            var mapAttrs = new Entities("BP.Sys.MapAttrs");
                            mapAttrs.Retrieve("FK_MapData", frmID, "Name", name);
                            if (mapAttrs.length >= 1) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtMap();
                                return;
                            }

                            //获得ID.
                            var id = StrToPinYin(name);
                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert('名称：[' + name + "]已经存在.");
                                ExtMap();
                                return;
                            }

                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.UIContralType = 4; //地图.
                            mapAttr.MyPK = mypk;
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 1; //
                            mapAttr.UIWidth = 800;//宽度
                            mapAttr.UIHeight = 500;//高度
                            mapAttr.Insert(); //插入字段.

                            var mapAttr1 = new Entity("BP.Sys.MapAttr");
                            mapAttr.UIContralType = 0;
                            mapAttr1.MyPK = frmID + "_AtPara";
                            mapAttr1.FK_MapData = frmID;
                            mapAttr1.KeyOfEn = "AtPara";
                            mapAttr1.UIVisible = 0;
                            mapAttr1.Name = "AtPara";
                            mapAttr1.GroupID = groupID;
                            mapAttr1.MyDataType = 1;
                            mapAttr1.LGType = 0;
                            mapAttr1.ColSpan = 1; //
                            mapAttr1.UIWidth = 100;
                            mapAttr1.UIHeight = 23;
                            mapAttr1.Insert(); //插入字段

                            mapAttr.Retrieve();
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.Sys.FrmUI.ExtMap&MyPK=" + mapAttr.MyPK);
                        }
                        //流程进度图.
                        function ExtJobSchedule() {

                            var name = "流程进度图";
                            var id = "JobSchedule";
                            var frmID = GetQueryString("FK_MapData");

                            //获得ID.
                            var mypk = frmID + "_" + id;
                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.MyPK = mypk;
                            if (mapAttr.IsExits == true) {
                                alert("已经存在，一个表单仅仅允许有一个流程进度图.");
                                return;
                            }

                            var mapAttr = new Entity("BP.Sys.MapAttr");
                            mapAttr.UIContralType = 50; //流程进度图.
                            mapAttr.MyPK = mypk;
                            mapAttr.FK_MapData = frmID;
                            mapAttr.KeyOfEn = id;
                            mapAttr.Name = name;
                            mapAttr.GroupID = groupID;
                            mapAttr.MyDataType = 1;
                            mapAttr.LGType = 0;
                            mapAttr.ColSpan = 4; //
                            mapAttr.UIWidth = 0;
                            mapAttr.UIHeight = 100;
                            mapAttr.Idx = 0;
                            mapAttr.Insert(); //插入字段.
                            mapAttr.Retrieve();
                            SetHref("../../Comm/EnOnly.htm?EnName=BP.WF.Template.ExtJobSchedule&MyPK=" + mapAttr.MyPK);

                        }

                    </script>
                    <ul>
                        <li><a href="javascript:Enum('AddEnum');"><b>枚举型</b></a> - 比如：性别:男/女。请假类型：事假/病假/婚假/产假/其它。</li>
                        <li><a href="javascript:Enum('NewEnum');">新建枚举 </a></li>
                    </ul>
                </td>
            </tr>
            <tr>
                <th colspan="2">
                    新增下拉框(外键、外部表、WebServices)字典表字段(通常只有编号名称两个列)
                </th>
            </tr>
            <tr>
                <td colspan="2">
                    <ul>
                        <li><a href="javascript:Table('AddSFTable')"><b>外键、外部数据、webservices数据类型</b></a> - 比如：岗位、税种、行业、科目，本机上一个表组成一个下拉框。</li>
                        <li><a href="javascript:TableGuide()">新建字典表</a></li>
                    </ul>
                </td>
            </tr>
            <tr>
                <th colspan="2">
                    从已有表里导入字段
                </th>
            </tr>
            <tr>
                <td colspan="2">
                    <ul>
                        <li><a href="javascript:ImpTableField();"><b>导入字段</b></a> &nbsp;&nbsp;从现有的表中导入字段,以提高开发的速度与字段拼写的正确性.</li>
                    </ul>
                </td>
            </tr>
            <tr>
                <th colspan="2">
                    字段扩展组件
                </th>
            </tr>
            <tr>
                <td colspan="2">
                    <ul>
                        <li><a href="javascript:ExtImg();"><b>装饰类图片</b></a> &nbsp;&nbsp;用于显示icon、头像、作业示意图等.</li>
                        <li><a href="javascript:ExtImgAth();"><b>图片附件</b></a> &nbsp;&nbsp;用于显示头像等图片.</li>
                        <li><a href="javascript:ExtIDCard();"><b>身份证</b></a> &nbsp;&nbsp;用于扫描身份证获取用户信息.</li>
                        <li><a href="javascript:ExtAth();"><b>多附件</b></a> &nbsp;&nbsp;上传多附件.</li>
                        <li><a href="javascript:ExtLink();"><b>超链接</b></a> &nbsp;&nbsp;用于解析把字段做为超链接展现.</li>
                        <li><a href="javascript:ExtHandWriting();"><b>写字板</b></a> &nbsp;&nbsp;手写签名版，画图等.</li>
                        <li><a href="javascript:ExtMap();"><b>地图</b></a> &nbsp;&nbsp;用于地图应用.</li>
                        <li><a href="javascript:MapAttrFixed();"><b>系统定位</b></a> &nbsp;&nbsp;用于定位当前系统所在的位置.</li>
                        <li><a href="javascript:ExtScore();"><b>评分控件</b></a> &nbsp;&nbsp;用于各事项评分，如淘宝星级评分.</li>
                        <li><a href="javascript:ExtBigNoteHtmlText();"><b>大块Html说明文字引入</b></a> &nbsp;&nbsp;大块文本文件引入,用于文字说明..</li>
                    </ul>
                </td>
            </tr>

            <tr>
                <th colspan="2">
                    字段扩展组件-流程类
                </th>
            </tr>
            <tr>
                <td colspan="2">
                    <ul>
                        <li><a href="javascript:ExtJobSchedule();"><b>工作进度图</b></a> &nbsp;&nbsp;流程进度的图形,适用于直线流程.</li>
                    </ul>
                </td>
            </tr>

        </table>
    </form>
</body>
</html>
